<template>
  <div>
    <button @click="addCount(20)">child的add按钮</button>

    <button @click="addAsyncFn">child的异步add按钮 20</button>
    <button @click="asyncAddCount(10)">child的异步add按钮 10</button>
    
    <h3>我是childa的 数组 ： {{ oddList }}</h3>

    <h3> {{ $store.state.user.username }} --- {{ $store.state.setting.address }} </h3>
  </div>
 
</template>

<script>
import { mapMutations, mapActions, mapGetters } from 'vuex'

export default {
  name: 'child-a',
  computed: {
    ...mapGetters(['oddList'])
  },
  methods: { 
    ...mapMutations(['addCount']),
    ...mapActions(['asyncAddCount']),

    addAsyncFn () {
      this.$store.dispatch('asyncAddCount', 20)
    }
  }
}
</script>

<style>

</style>